#ifndef CONFIGIMPL_H
#define CONFIGIMPL_H

#include <defs/global.h>

#include <config/configfile.h>
#include <QtCore>



O_PRIVATE_DECLARE(ConfigStack);

class ConfigStack : public Opl::Core::IConfig {
public:
    ConfigStack();
    ~ConfigStack();

    void addFile(const QString& filename, bool readonly);
    bool load();
    bool save();

    QVariantList values(const QString& path);
    QVariant value(const QString& path, const QVariant& def = QVariant());

    QVariant value(const QString& section, const QString& key, const QVariant& def = QVariant());
    void setValue(const QString& section, const QString& key, const QVariant& val);

    static ConfigStack* config();

    O_PRIVATE_DECLARE_MEMBER(ConfigStack);

};

inline QVariant conf(const QString& section, const QString& key, const QVariant& def = QVariant()){
    return ConfigStack::config()->value(section, key, def);
}


#endif // CONFIGIMPL_H

